{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->

                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test2" lay-filter="demo"></table>
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.coupon_image}}" class="layui-table-img layui-cricle" onerror="this.src='/static/admin/images/head_default.gif'"/>
                    </script>
                    <script type="text/html" id="mc_ercode">
                        <img src="{{d.mc_ercode}}" class="layui-table-img layui-cricle" onerror="this.src='/static/admin/images/head_default.gif'"/>
                    </script>
                    <script type="text/html" id="mc_send">
                        {{# if(d.mc_send ==1){ }}
                        否
                        {{# } }}
                        {{# if(d.mc_send ==2){ }}
                        是
                        {{# } }}
                    </script>
                    <script type="text/html" id="mc_status">
                        {{# if(d.mc_status ==1){ }}
                        未核销
                        {{# } }}
                        {{# if(d.mc_status ==2){ }}
                        已核销
                        {{# } }}
                        {{# if(d.mc_status ==3){ }}
                        已到期
                        {{# } }}
                    </script>
                    <script type="text/html" id="mc_send_status1">
                        {{# if(d.mc_send_status ==2){ }}
                        待领取
                        {{# } }}
                        {{# if(d.mc_send_status ==3){ }}
                        已领取
                        {{# } }}
                        {{# if(d.mc_send_status ==4){ }}
                        已退还
                        {{# } }}
                    </script>
                    <script type="text/html" id="mc_send_status2">
                        {{# if(d.mc_send_status ==3){ }}
                        {{d.mc_take_time}}
                        {{# } }}
                    </script>
                    <script type="text/html" id="mc_send_status3">
                        {{# if(d.mc_send_status ==4){ }}
                        {{d.mc_take_time}}
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test2'
            , url: '{:url("Consumer/usercoupon")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 120
            , limits: [5, 10, 15, 20, 25, 30]
            , where: {id:{$id}}
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 70, title: '序号'}
                , {field: 's_name', width: '', title: '商家名字', align: 'center'}
                , {field: 's_phone', width: '', title: '商家手机号', align: 'center'}
                , {field: 'user_username', width: '', title: '领取用户', align: 'center'}
                , {field: 'user_phone', width: '', title: '领取用户电话', align: 'center'}
                , {field: 'mc_time', width: '', title: '领取时间', align: 'center'}
                , {field: 'coupon_image', width: '', title: '优惠券图片', align: 'center',templet:'#imgTpl'}
                , {field: 'coupon_name', width: '', title: '优惠券名称', align: 'center'}
                , {field: 'coupon_price', width: '', title: '兑换金币', align: 'center'}
                , {field: 'coupon_money', width: '', title: '面额', align: 'center'}
                , {field: 'mc_code', width: '', title: '券码', align: 'center'}
                , {field: 'mc_ercode', width: '', title: '二维码', align: 'center',templet:'#mc_ercode'}
                , {field: 'mc_status', width: '', title: '是否核销', align: 'center',templet:'#mc_status'}
                , {field: 'mc_use_time', width: '', title: '核销时间', align: 'center'}
                , {field: 'mc_send', width: '', title: '是否赠送', align: 'center',templet:'#mc_send'}
                , {field: 'user_username2', width: '', title: '赠送人', align: 'center'}
                , {field: 'user_phone2', width: '', title: '赠送人电话', align: 'center'}
                , {field: 'mc_send_time', width: '', title: '赠送时间', align: 'center'}
                , {field: 'mc_send_status', width: '', title: '领取状态', align: 'center',templet:'#mc_send_status1'}
                , {field: 'mc_send_status', width: '', title: '领取时间', align: 'center',templet:'#mc_send_status2'}
                , {field: 'mc_send_status', width: '', title: '退还时间', align: 'center',templet:'#mc_send_status3'}
            ]]
            ,done: function (res, curr, count) {
                $('.layui-cricle').viewer();//图片查看器
            }
        });

    });
</script>
</body>
</html>